package com.effectiv.gooruda.rest.service.api;

import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.effectiv.gooruda.rest.docs.annotation.Api;
import com.effectiv.gooruda.rest.docs.annotation.ApiHeader;
import com.effectiv.gooruda.rest.docs.annotation.ApiHeaders;
import com.effectiv.gooruda.rest.docs.annotation.ApiMethod;
import com.effectiv.gooruda.rest.docs.annotation.ApiParam;
import com.effectiv.gooruda.rest.docs.annotation.ApiResponseObject;
import com.effectiv.gooruda.rest.docs.pojo.ApiVerb;

@Path("/twitter/directmessage")
@Api(name = "Twitter - Direct Message API", description = "Twitter - Direct Message operations API.")
public abstract class TwitterDirectMessageService {

	/**
	 * Delete a direct message
	 * 
	 * @param provider
	 * @param messageId
	 * @return
	 */

	@ApiMethod(path = "/api/twitter/directmessage/{provider}/{messageId}", verb = ApiVerb.DELETE, description = "Delete a direct message.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@DELETE
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/{provider}/{messageId}")
	public abstract @ApiResponseObject
	Response deleteDirectMessage(
			@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider,
			@PathParam("messageId") @ApiParam(name = "messageId", description = "Message Id") long messageId);

	/**
	 * Get direct message by id
	 * 
	 * @param provider
	 * @param id
	 * @return
	 */

	@ApiMethod(path = "/api/twitter/directmessage/{provider}/{messageId}", verb = ApiVerb.GET, description = "Get direct message by id.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@GET
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/{provider}/{messageId}")
	public abstract @ApiResponseObject
	Response getDirectMessage(
			@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider,
			@PathParam("messageId") @ApiParam(name = "messageId", description = "Message Id") long messageId);

	/**
	 * Get all direct messages received.
	 * 
	 * @param provider
	 * @param page
	 * @param pageSize
	 * @param sinceId
	 * @param maxId
	 * @return
	 */

	@ApiMethod(path = "/api/twitter/directmessage/recieved/{provider}", verb = ApiVerb.GET, description = "Get direct messages received.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@GET
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/recieved/{provider}")
	public abstract @ApiResponseObject Response getDirectMessagesReceived(
			@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider,
			@QueryParam("page") @DefaultValue("0") @ApiParam(name = "page", description = "The page to return.") int page,
			@QueryParam("pageSize") @DefaultValue("20") @ApiParam(name = "pageSize", description = "The number of DirectMessages per page. Should be less than or equal to 200.(Will return at most 200 entries, even if pageSize is greater than 200.)") int pageSize,
			@QueryParam("sinceId") @DefaultValue("-1") @ApiParam(name = "sinceId", description = "The minimum DirectMessage ID to return in the results.") long sinceId,
			@QueryParam("maxId") @DefaultValue("-1") @ApiParam(name = "maxId", description = "The maximum DirectMessage ID to return in the results.") long maxId);

	/**
	 * Get direct messages sent.
	 * @param provider
	 * @param page
	 * @param pageSize
	 * @param sinceId
	 * @param maxId
	 * @return
	 */
	
	@ApiMethod(path = "/api/twitter/directmessage/sent/{provider}", verb = ApiVerb.GET, description = "Get direct messages sent.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@GET
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/sent/{provider}")
	
	public abstract @ApiResponseObject Response getDirectMessagesSent(
			@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider,
			@QueryParam("page") @DefaultValue("0") @ApiParam(name = "page", description = "The page to return.") int page,
			@QueryParam("pageSize") @DefaultValue("20") @ApiParam(name = "pageSize", description = "The number of DirectMessages per page. Should be less than or equal to 200.(Will return at most 200 entries, even if pageSize is greater than 200.)") int pageSize,
			@QueryParam("sinceId") @DefaultValue("-1") @ApiParam(name = "sinceId", description = "The minimum DirectMessage ID to return in the results.") long sinceId,
			@QueryParam("maxId") @DefaultValue("-1") @ApiParam(name = "maxId", description = "The maximum DirectMessage ID to return in the results.") long maxId);
	
	/**
	 * Sends a direct message to another Twitter user
	 * @param provider
	 * @param toScreenName
	 * @param text
	 * @return
	 */
	
	@ApiMethod(path = "/api/twitter/directmessage/{provider}/{toScreenName}/{text}", verb = ApiVerb.POST, description = "Sends a direct message to another Twitter user.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/{provider}/{toScreenName}/{text}")
	public abstract @ApiResponseObject Response sendDirectMessage(
			@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider,
			@PathParam("toScreenName") @ApiParam(name = "toScreenName", description = "Screen name of the recipient of the message.") String toScreenName, 
			@PathParam("text") @ApiParam(name = "text", description = "Message text.") String text);
	
	/**
	 * Sends a direct message to another Twitter user by id
	 * @param provider
	 * @param toUserId
	 * @param text
	 * @return
	 */
	
	
	@ApiMethod(path = "/api/twitter/directmessage/{provider}/{toUserId}/{text}", verb = ApiVerb.POST, description = "Sends a direct message to another Twitter user.", produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON })
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Path("/{provider}/{toUserId}/{text}")
	
	public abstract Response sendDirectMessage(@PathParam("provider") @ApiParam(name = "provider", description = "Twitter identifier for the application.") String provider, 
			@PathParam("toUserId") @ApiParam(name = "toUserId", description = "Screen name of the recipient of the message.") long toUserId,
			@PathParam("text") @ApiParam(name = "text", description = "Message text.") String text);

}
